//
//  Producer.java
//  ics314-calendar
//
//  Created by ICS314 Team Mississippi  on 7/30/14.
//  Copyright (c) 2014 JinHao Chen, Christian Caluya,Kevin Fujikawa. All rights reserved.
//
import static org.junit.Assert.*;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

public class testJudgment {

	Judgment judgment;
	/**
	 * @throws java.lang.Exception
	 */
	@Before
	public void setUp() throws Exception {
		judgment = new Judgment();
	}

	/**
	 * @throws java.lang.Exception
	 */
	@After
	public void tearDown() throws Exception {
	}

	@Test
	public void test_isDate() {
		assertEquals(Judgment.isDate("07/12/2014 11:22:33"),true);
		assertEquals(Judgment.isDate("13/12/2014 11:55:77"),false);
		assertEquals(Judgment.isDate("7/12/2014 11:22:33"),false);
		assertEquals(Judgment.isDate("02/29/2014 11:22:33"),false);
		assertEquals(Judgment.isDate("02/29/2000 11:22:33"),true);
	}
	
	@Test
	public void test_compareDate(){
		assertEquals(Judgment.compareDate("07/12/2014 11:22:33", "07/13/2014 11:22:33"),-1);
		assertEquals(Judgment.compareDate("07/12/2014 11:22:33", "07/12/2014 11:22:33"),0);
		assertEquals(Judgment.compareDate("07/14/2015 11:22:33", "07/13/2014 09:21:33"),1);
	}
	
	@Test
	public void test_convertDateAndTime(){
		assertEquals(Judgment.convertDateAndTime("07/12/2014", "11:22:33"),"20140712T112233");
		assertEquals(Judgment.convertDateAndTime("01/12/2014", "22:23:35"),"20140112T222335");
		assertEquals(Judgment.convertDateAndTime("07/12/1990", "09:22:33"),"19900712T092233");
	}
	@Test
	public void test_convertTZOffSetTo(){
		assertEquals(Judgment.convertTZOffSetTo("America/New_York"),"-0500");
		assertEquals(Judgment.convertTZOffSetTo("Pacific/Honolulu"),"-1000");
	}
	@Test
	public void test_convertTZOffSetFrom(){
		assertEquals(Judgment.convertTZOffSetFrom("America/New_York"),"-0400");
		assertEquals(Judgment.convertTZOffSetFrom("Pacific/Honolulu"),"-1000");
	}

}
